<template>
  <div v-loading="loading">
    <queryHead  v-if="head"  :explain="explain" :result="msg" :time="time" :price="price" @query="query"/>
    <div v-if="lock" style="background-color: #fafafa;padding: 5px;border-radius: 5px">
      <i class="el-icon-s-data" style="display: block; margin-bottom: 10px">
        <label>申请意向</label>
      </i>
      <table class="sfhy">
        <thead>
        <tr>
          <th>申请 \ 时间</th>
          <th>近7天</th>
          <th>近 1 个月</th>
          <th>近 3 个月</th>
          <th>近 6 个月</th>
          <th>近 12 个月</th>
        </tr>
        </thead>
        <tbody>
        <tr>
          <td>申请平台数</td>
          <td>{{ 'd7_apply_agency_time' in zulin ? zulin.d7_apply_agency_time : '' }}</td>
          <td>{{ 'm1_apply_agency_time' in zulin ? zulin.m1_apply_agency_time : '' }}</td>
          <td>{{ 'm3_apply_agency_time' in zulin ? zulin.m3_apply_agency_time : '' }}</td>
          <td>{{ 'm6_apply_agency_time' in zulin ? zulin.m6_apply_agency_time : '' }}</td>
          <td>{{ 'm12_apply_agency_time' in zulin ? zulin.m12_apply_agency_time : '' }}</td>
        </tr>
        <tr>
          <td>申请次数</td>
          <td>{{ 'd7_apply_time' in zulin ? zulin.d7_apply_time : '' }}</td>
          <td>{{ 'm1_apply_time' in zulin ? zulin.m1_apply_time : '' }}</td>
          <td>{{ 'm3_apply_time' in zulin ? zulin.m3_apply_time : '' }}</td>
          <td>{{ 'm6_apply_time' in zulin ? zulin.m6_apply_time : '' }}</td>
          <td>{{ 'm12_apply_time' in zulin ? zulin.m12_apply_time : '' }}</td>
        </tr>
        <tr>
          <td>在夜间申请平台数</td>
          <td>{{ 'd7_night_apply_agency_time' in zulin ? zulin.d7_night_apply_agency_time : '' }}</td>
          <td>{{ 'm1_night_apply_agency_time' in zulin ? zulin.m1_night_apply_agency_time : '' }}</td>
          <td>{{ 'm3_night_apply_agency_time' in zulin ? zulin.m3_night_apply_agency_time : '' }}</td>
          <td>{{ 'm6_night_apply_agency_time' in zulin ? zulin.m6_night_apply_agency_time : '' }}</td>
          <td>{{ 'm12_night_apply_agency_time' in zulin ? zulin.m12_night_apply_agency_time : '' }}</td>
        </tr>
        <tr>
          <td>在夜间申请次数</td>
          <td>{{ 'd7_night_apply_time' in zulin ? zulin.d7_night_apply_time : '' }}</td>
          <td>{{ 'm1_night_apply_time' in zulin ? zulin.m1_night_apply_time : '' }}</td>
          <td>{{ 'm3_night_apply_time' in zulin ? zulin.m3_night_apply_time : '' }}</td>
          <td>{{ 'm6_night_apply_time' in zulin ? zulin.m6_night_apply_time : '' }}</td>
          <td>{{ 'm12_night_apply_time' in zulin ? zulin.m12_night_apply_time : '' }}</td>
        </tr>
        </tbody>
      </table>

      <div style="margin-top: 10px">
        <i class="el-icon-s-check">
          <label>关联情况</label>
        </i>
        <div id="glqk">
          <div>
            <h6>同一身份证关联手机号数：
              <span>{{ 'ident_contain_phone_ct' in zulin ? zulin.ident_contain_phone_ct : '' }}</span>
            </h6>
          </div>
          <div>
            <h6>同一手机号关联身份证数：
              <span> {{ 'phone_contain_ident_ct' in zulin ? zulin.phone_contain_ident_ct : '' }}</span>
            </h6>
          </div>
        </div>

      </div>

    </div>
  </div>
</template>

<script>
  import queryHead from "@/views/components/queryHead.vue";
  import {queryRecord, queryData} from "@/api/system/query";

  export default {
    components: {queryHead},
    name: "sqyx",
    props: {
      queryData: {
        required: true,
        type: Object
      },
      price: {
        default: null,
        type: Number
      },
      priceType: {
        default: null,
        type: Boolean
      },
      explain: {
        default: null,
        type: String
      },
      head: {
        default: true,
        type: Boolean
      }
    },
    data() {
      return {
        loading: false,
        lock: false,

        msg: undefined,
        time: undefined,

        zulin: {
          d7_apply_time: "未命中",
          m6_apply_time: "未命中",
          m6_night_apply_agency_time: "未命中",
          m3_apply_agency_time: "未命中",
          m12_apply_agency_time: "未命中",
          m1_apply_time: "未命中",
          ident_last_apply_time: "未命中",
          d7_night_apply_agency_time: "未命中",
          m12_apply_time: "未命中",
          m3_night_apply_time: "未命中",
          m1_apply_agency_time: "未命中",
          m12_night_apply_agency_time: "未命中",
          d7_night_apply_time: "未命中",
          m1_night_apply_agency_time: "未命中",
          phone_contain_ident_ct: "未命中",
          m6_night_apply_time: "未命中",
          ident_contain_phone_ct: "未命中",
          m1_night_apply_time: "未命中",
          m12_night_apply_time: "未命中",
          m3_apply_time: "未命中",
          d7_apply_agency_time: "未命中",
          m6_apply_agency_time: "未命中",
          m3_night_apply_agency_time: "未命中"
        },
      }
    },
    created() {
      this.loading = true
      queryRecord(this.queryData).then(response => {
        this.disResponse(response)
      })
    },

    methods: {
      query() {
        this.loading = true
        queryData(this.queryData).then(response => {
          this.disResponse(response)
        });
      },
      disResponse(response) {
        console.log('--sqyx--', response)
        if (response.info) {
          this.time = response.time
          const data = JSON.parse(response.info)
          this.msg = data.retmsg
          if (data.retcode == '000000') {
            const retdata = data.retdata
            if (retdata.resultCode == 1) {
              this.zulin = retdata.detail

              console.log(this.zulin)

            } else {
              this.msg = retdata.messge
              this.$modal.msg('申请意向：' + retdata.messge)
            }
          } else {
            this.$modal.msgWarning('申请意向：' + data.retmsg)
          }
          this.lock = true
        }
        this.loading = false
      }
    }
  };
</script>

<style scoped>

  .sfhy {
    margin: 0 auto;
    border: 1px solid #ccc;
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
  }

  .sfhy th {
    text-align: center;
    padding: 12px 0px;
    background-color: #f5f5f5;
  }

  .sfhy td {
    text-align: center;
    border: 1px solid #ccc;
    padding: 12px 0px;
  }

  #glqk {
    display: flex;
    justify-content: space-around;
    /*font-size: 16px;*/
    div {
      width: 50vw;
      text-align: center;
    }
  }
  #glqk span {
    margin-left: 50px;

  }
</style>
